import axios from 'axios'

//获取轮播图
function getCarousel() {
  return new Promise((resolve, reject) => {
    axios.get(`/getCarousel`).then(result => {
      if (result.data.ok == 1) resolve(result.data.result)
      else reject()
    })
  })
}
// 获取毕业精选商品
function getChoice() {
  return new Promise((resolve, reject) => {
    axios.get('/getChoice').then(result => {
      if (result.data.ok == 1) resolve(result.data.result)
      else reject()
    })
  })
}

// 获取看海商品
function getOcean() {
  return new Promise((resolve, reject) => {
    axios.get('/getOcean').then(result => {
      if (result.data.ok == 1) resolve(result.data.result)
      else reject()
    })
  })
}

// 获取扫货商品
function getShopping() {
  return new Promise((resolve, reject) => {
    axios.get('/getShopping').then(result => {
      if (result.data.ok == 1) resolve(result.data.result)
      else reject()
    })
  })
}

export { getCarousel, getChoice, getOcean, getShopping }
